<template>
    <div>
        <header-footer :commonData="{$parent:$parent,indexLogo:1}">
            <div class="newsCenter" v-cloak>
                <div class="crumb width1200">
                    <ul>
                        <li class="f_left">当前位置：</li>
                        <li class="f_left">
                            <router-link to="/home">首页></router-link>
                        </li>
                        <li class="f_left">考培快讯</li>
                    </ul>
                </div>
                <div class="news_content">
                    <div class="news_tabs_content" style="width: 1150px;margin-left: 0;">
                        <h3 class="text_center">考培快讯</h3>
                        <div class="news_tab_table_box">
                            <table class="news_tab_table" width="100%">
                                <tbody>
                                    <tr v-for="(item,index) in newsLst" :key="index">
                                        <td class="news_tab_table_tr1 text_left">
                                            <router-link class="color333" target="_blank"
                                                :to="String.Format('/news/news_info/{0}',item.id)" :title="item.title">
                                                {{item.title}}</router-link>
                                        </td>
                                        <td class="text_right">
                                            {{new Date(item.updateTime).Format("yyyy-MM-dd")}}
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                            :current-page.sync="pageNo" :page-sizes="[5, 10]"
                            layout="total, sizes, prev, pager, next, jumper" :total="total">
                        </el-pagination>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
        </header-footer>
    </div>
</template>

<script>
    import headerFooter from '../../components/cont_education/header_and_footer.vue'
    export default {
        name: 'news_center',
        data() {
            return {
                title: "考培快讯",
                total: 100,
                limit: 10,
                pageNo: 1,
                newsLst: [],
            }
        },
        mounted: function() {
            this.init();
        },
        methods: {
            init: function() {
                this.getList();
            },
            getList: function() {
                // this.currentPage = pageNo;
                var that = this;
                this.common.post(this.api.getNewsList, {
                    newsType: 3,
                    minId: this.pageNo,
                    pageSize: this.limit,
                }, function(res) {
                    that.total = parseInt(res.total);
                    that.newsLst = res.resultMap;
                });
            },
            //分页当前页点击
            handleCurrentChange: function(val) {
                this.pageNo = val;
                this.getList();
            },
            //分页选择
            handleSizeChange: function(val) {
                this.pageNo = 1;
                this.limit = val;
                this.getList();
            },
        },
        components: {
            headerFooter
        },
        watch: {
            '$route': function(to, from) {
                this.init();
            }
        }
    }
</script>

<style>
</style>
